﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>新增社保机构信息</title>
  <style>
	form label {
	  display: inline-block;
	  width: 225px;
	  font-weight: bold;
	}  
  </style>
</head>
<body>
  <h2>新增社保机构信息</h2>

  <p>社保机构信息:</p>
  <form method="POST" action="">
    <label for="portfolio_code">社保基金组合:</label>
    <input type="text" name="portfolio_code" /><br/><br/>

    <label for="short_portfolio_code">社保基金组合缩写:</label>
    <input type="text" name="short_portfolio_code" /><br/><br/>
    
    <label for="admin_org">管理机构:</label>
    <input type="text" name="admin_org" /><br/><br/>
        
    <label for="invest_orientation">投资方向</label>
    <textarea name="invest_orientation"></textarea><br/><br/>
    
    <input type="submit" value="提交" name="submit" />
  </form>
  
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  $portfolio_code = $_POST['portfolio_code'];
  $short_portfolio_code = $_POST['short_portfolio_code'];  
  $admin_org = $_POST['admin_org'];
  $invest_orientation = $_POST['invest_orientation'];

  $query = "INSERT INTO org_shebao (portfolio_code, short_portfolio_code, admin_org, invest_orientation) " .
    "VALUES ('$portfolio_code', '$short_portfolio_code', '$admin_org', '$invest_orientation')";
    
  $dbc = mysqli_connect('localhost', 'root', 'k00l@1D;', 'gudahu')
    or die('Error connecting to MySQL server.');
  mysqli_set_charset($dbc, 'utf8');

  $result = mysqli_query($dbc, $query)
    or die('Error querying database.');

  mysqli_close($dbc);

	echo "表单提交";
	echo "<br/>";
	echo '社保基金组合 - '.$_POST['portfolio_code'].'<br/>';
	echo '社保基金组合缩写 - '.$_POST['short_portfolio_code'].'<br/>';
	echo '管理机构 - '.$_POST['admin_org'].'<br/>';
	echo '投资方向 - '.$_POST['invest_orientation'].'<br/>';
}
?>
  
</body>
</html>